<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/views/include/easyui.jsp"%>

</head>
<body>
<div>
	<form id="mainform" action="${ctx}/product/${action}" method="post">
	<table  class="formTable">
		<tr>
			<td width="15%" align="right">产品名称：</td>
			<td width="35%">
				<input type="hidden" name="id" value="${product.id }" />
				<input id="pname" name="pname" type="text" value="${product.pname }" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,50]"/>
			</td>
			<td width="18%" align="right">产品编码：</td>
			<td width="32%"><input id="pcode" name="pcode" value="${product.pcode }" type="text" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,30]"/></td>
		</tr>
		<tr>
			<td align="right">产品类型：</td>
			<td>
				<input id="productType" name="productType" readonly/>
			</td>
			<td align="right">募集资金：</td>
			<td><input id="totalMoney" name="totalMoney" type="text" value="${product.totalMoney }" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,20]"/></td>
		</tr>
		<tr>
			<td align="right">投资期限：</td>
			<td>
				<input id="investPeriod" name="investPeriod" type="text" value="${product.investPeriod }" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,10]"/>
			</td>
			<td align="right">期限单位：</td>
			<td>
				<select id="periodUnit" class="easyui-combobox"
						name="periodUnit" data-options="required:'required'" readonly>
							<option value=''></option>
							<option value='年' ${product.periodUnit=='年'?'selected':''}>年</option>
							<option value='月' ${product.periodUnit=='月'?'selected':''}>月</option>
							<option value='日' ${product.periodUnit=='日'?'selected':''}>日</option>
				</select>	
			</td>
		</tr>
		<tr>
			<td align="right">起购金额：</td>
			<td>
				<input id="minBuyMoney" name="minBuyMoney" type="text" value="${product.minBuyMoney }" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,20]"/>
			</td>
			<td align="right">投资步长：</td>
			<td><input id="stepLength" name="stepLength" type="text" value="${product.stepLength }" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,20]"/></td>
		</tr>
		<tr>
			<td align="right">开始日期：</td>
			<td>
				<input id="beginAgentDay" name="beginAgentDay" type="text" value="${product.beginAgentDay }" class="easyui-my97" datefmt="yyyy-MM-dd" data-options="width: 180,required:'required'" value="<fmt:formatDate value="${product.beginAgentDay}"/>"/>
			</td>
			<td align="right">结束日期：</td>
			<td><input id="endPaymentDay" name="endPaymentDay" type="text" value="${product.endPaymentDay }" class="easyui-my97" datefmt="yyyy-MM-dd" data-options="width: 180,required:'required'" value="<fmt:formatDate value="${product.endPaymentDay}"/>"/></td>
		</tr>
		<tr>
			<td align="right">代理人数限制：</td>
			<td>
				<input id="agentUserNum" name="agentUserNum" type="text" value="${product.agentUserNum }" class="easyui-validatebox"  data-options="width: 180,required:'required'" validType="length[0,6]"/>
			</td>
			<td align="right">产品状态：</td>
			<td>
				<select id="hotStatus" class="easyui-combobox"
						name="hotStatus" data-options="required:'required'" readonly>
							<option value=''></option>
							<option value='0' ${product.hotStatus=='0'?'selected':''}>普通</option>
							<option value='1' ${product.hotStatus=='1'?'selected':''}>推荐</option>
							<option value='2' ${product.hotStatus=='2'?'selected':''}>热门</option>
							<option value='3' ${product.hotStatus=='3'?'selected':''}>轮播</option>
				</select>
			</td>
		</tr>
<!-- 		<tr> -->
<!-- 			<td align="right">产品图片URL：</td> -->
<!-- 			<td colspan="3"> -->
<%-- 				<input id="imgUrl" name="imgUrl" type="text" value="${product.imgUrl }" class="easyui-validatebox"  data-options="width: 488,required:'required'" validType="length[0,100]"/> --%>
<!-- 			</td> -->
<!-- 		</tr> -->
		<tr>
			<td align="right">产品详情URL：</td>
			<td colspan="3">
				<input id="detailUrl" name="detailUrl" type="text" value="${product.detailUrl }" class="easyui-validatebox"  data-options="width: 488,required:'required'" validType="length[0,100]"/>
			</td>
		</tr>
		<tr>
			<td align="right">产品分享URL：</td>
			<td colspan="3">
				<input id="shareUrl" name="shareUrl" type="text" value="${product.shareUrl }" class="easyui-validatebox"  data-options="width: 488" validType="length[0,100]"/>
			</td>
		</tr>
	</table>
	</form>
</div>
<script type="text/javascript">

$('#periodUnit').combobox({
	width : 110,
	panelHeight:100
});

$('#hotStatus').combobox({
	width : 110,
	panelHeight:100
});

var action="${action}";

if(action=='update'){
	if('${product.publishStatus}' == '1') {
		$('#pcode').attr("readonly","true");
	}
	$('#productType').val('${product.ptcode.typename}');
	$('#productType').attr("disabled","disabled");
}

//上级菜单
$('#productType').combobox({
	width:180,
	method:'GET',
    url: '${ctx}/product/productType/listAll',
    valueField : 'typecode',
    textField : 'typename'
}); 

$(function(){
	$('#mainform').form({    
	    onSubmit: function(){    
	    	var isValid = $(this).form('validate');
			return isValid;	// 返回false终止表单提交
	    },    
	    success:function(data){   
	    	successTip(data,dg,d);
	    }    
	}); 
});

</script>
</body>
</html>